package com.chenxi.controller;

import com.ganyu.annotation.SystemLog;
import com.ganyu.domain.ResponseResult;
import com.ganyu.domain.entity.User;
import com.ganyu.domain.vo.UserInfoVo;
import com.ganyu.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * DATA: 2022/9/27
 * Author: 晨夕
 */
@RequestMapping("/user")
@RestController
public class UserInfoController {

    @Autowired
    private UserServiceImpl userServiceImpl;

    //查询个人信息
    @GetMapping("/userInfo")
    public ResponseResult<UserInfoVo> getUserInfo(){
        return userServiceImpl.getUserInfo();
    }

    //修改个人信息
    @PutMapping("/userInfo")
    @SystemLog(businessName = "更新用户信息")
    public ResponseResult<UserInfoVo> updateUserInfo(@RequestBody User user){
        return userServiceImpl.updateUserInfo(user);
    }

    //用户注册
    @PostMapping("/register")
    public ResponseResult<UserInfoVo> userRegister(@RequestBody User user){
        return userServiceImpl.userRegister(user);
    }
}
